import { http } from "@/utils/http";
import baseUrlProxy from "@/api/baseUrlProxy";

export const getUserLogs = (data?: object) => {
  return http.request<any>("get", baseUrlProxy + "/api/logs/user", {
    params: data
  });
};
export const editUserCenter = (data?: object) => {
  return http.request<any>("put", baseUrlProxy + "/api/users/center", {
    data: data
  });
};
export const updatePass = (data?: object) => {
  return http.request<any>("post", baseUrlProxy + "/api/users/updatePass/", {
    data: data
  });
};
export const resetEmailCode = (data?: object) => {
  return http.request<any>("post", baseUrlProxy + "/api/code/resetEmail", {
    params: data
  });
};
export const updateEmail = (data?: object, code) => {
  return http.request<any>(
    "post",
    baseUrlProxy + "/api/users/updateEmail/" + code,
    {
      data: data
    }
  );
};

export const updateAvatar = (data?: object) => {
  return http.request<any>(
    "post",
    baseUrlProxy + "/api/users/updateAvatar",
    {
      data: data
    },
    {
      headers: {
        "content-type": "multipart/form-data"
      }
    }
  );
};
